<!DOCTYPE html>
<html lang="">
    <!-- title -->




<!-- keywords -->




<head><meta name="generator" content="Hexo 3.8.0">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <meta name="author" content="Eric">
    <meta name="renderer" content="webkit">
    <meta name="copyright" content="Eric">
    
    <meta name="keywords" content="hexo,hexo-theme,hexo-blog">
    
    <meta name="description" content="">
    <meta http-equiv="Cache-control" content="no-cache">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Storm分布式实时计算框架详解 · VIK&#39;s blog</title>
    <style type="text/css">
    @font-face {
        font-family: 'Oswald-Regular';
        src: url("/blog/font/Oswald-Regular.ttf");
    }

    body {
        margin: 0;
    }

    header,
    footer,
    .back-top,
    .sidebar,
    .container,
    .site-intro-meta,
    .toc-wrapper {
        display: none;
    }

    .site-intro {
        position: relative;
        z-index: 3;
        width: 100%;
        /* height: 50vh; */
        overflow: hidden;
    }

    .site-intro-placeholder {
        position: absolute;
        z-index: -2;
        top: 0;
        left: 0;
        width: calc(100% + 300px);
        height: 100%;
        background: repeating-linear-gradient(-45deg, #444 0, #444 80px, #333 80px, #333 160px);
        background-position: center center;
        transform: translate3d(-226px, 0, 0);
        animation: gradient-move 2.5s ease-out 0s infinite;
    }

    @keyframes gradient-move {
        0% {
            transform: translate3d(-226px, 0, 0);
        }
        100% {
            transform: translate3d(0, 0, 0);
        }
    }

</style>

    <link rel="preload" href="/blog/css/style.css?v=20180824" as="style" onload="this.onload=null;this.rel='stylesheet'">
    <link rel="stylesheet" href="/blog/css/mobile.css?v=20180824" media="(max-width: 980px)">
    
    <link rel="preload" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.2.5/jquery.fancybox.min.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
    
    <!-- /*! loadCSS. [c]2017 Filament Group, Inc. MIT License */
/* This file is meant as a standalone workflow for
- testing support for link[rel=preload]
- enabling async CSS loading in browsers that do not support rel=preload
- applying rel preload css once loaded, whether supported or not.
*/ -->
<script>
(function( w ){
	"use strict";
	// rel=preload support test
	if( !w.loadCSS ){
		w.loadCSS = function(){};
	}
	// define on the loadCSS obj
	var rp = loadCSS.relpreload = {};
	// rel=preload feature support test
	// runs once and returns a function for compat purposes
	rp.support = (function(){
		var ret;
		try {
			ret = w.document.createElement( "link" ).relList.supports( "preload" );
		} catch (e) {
			ret = false;
		}
		return function(){
			return ret;
		};
	})();

	// if preload isn't supported, get an asynchronous load by using a non-matching media attribute
	// then change that media back to its intended value on load
	rp.bindMediaToggle = function( link ){
		// remember existing media attr for ultimate state, or default to 'all'
		var finalMedia = link.media || "all";

		function enableStylesheet(){
			link.media = finalMedia;
		}

		// bind load handlers to enable media
		if( link.addEventListener ){
			link.addEventListener( "load", enableStylesheet );
		} else if( link.attachEvent ){
			link.attachEvent( "onload", enableStylesheet );
		}

		// Set rel and non-applicable media type to start an async request
		// note: timeout allows this to happen async to let rendering continue in IE
		setTimeout(function(){
			link.rel = "stylesheet";
			link.media = "only x";
		});
		// also enable media after 3 seconds,
		// which will catch very old browsers (android 2.x, old firefox) that don't support onload on link
		setTimeout( enableStylesheet, 3000 );
	};

	// loop through link elements in DOM
	rp.poly = function(){
		// double check this to prevent external calls from running
		if( rp.support() ){
			return;
		}
		var links = w.document.getElementsByTagName( "link" );
		for( var i = 0; i < links.length; i++ ){
			var link = links[ i ];
			// qualify links to those with rel=preload and as=style attrs
			if( link.rel === "preload" && link.getAttribute( "as" ) === "style" && !link.getAttribute( "data-loadcss" ) ){
				// prevent rerunning on link
				link.setAttribute( "data-loadcss", true );
				// bind listeners to toggle media back
				rp.bindMediaToggle( link );
			}
		}
	};

	// if unsupported, run the polyfill
	if( !rp.support() ){
		// run once at least
		rp.poly();

		// rerun poly on an interval until onload
		var run = w.setInterval( rp.poly, 500 );
		if( w.addEventListener ){
			w.addEventListener( "load", function(){
				rp.poly();
				w.clearInterval( run );
			} );
		} else if( w.attachEvent ){
			w.attachEvent( "onload", function(){
				rp.poly();
				w.clearInterval( run );
			} );
		}
	}


	// commonjs
	if( typeof exports !== "undefined" ){
		exports.loadCSS = loadCSS;
	}
	else {
		w.loadCSS = loadCSS;
	}
}( typeof global !== "undefined" ? global : this ) );
</script>

    <link rel="icon" href="/blog/assets/favicon.jpg">
    <link rel="preload" href="https://cdn.jsdelivr.net/npm/webfontloader@1.6.28/webfontloader.min.js" as="script">
    <link rel="preload" href="https://cdn.jsdelivr.net/npm/jquery@3.3.1/dist/jquery.min.js" as="script">
    <link rel="preload" href="/blog/scripts/main.js" as="script">
    <link rel="preload" as="font" href="/blog/font/Oswald-Regular.ttf" crossorigin="">
    <link rel="preload" as="font" href="https://at.alicdn.com/t/font_327081_1dta1rlogw17zaor.woff" crossorigin="">
    
    <!-- fancybox -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.2.5/jquery.fancybox.min.js" defer></script>
    <!-- 百度统计  -->
    
    <!-- 谷歌统计  -->
    
</head>

    
        <body class="post-body">
    
    
<header class="header">

    <div class="read-progress"></div>
    <div class="header-sidebar-menu">&#xe775;</div>
    <!-- post页的toggle banner  -->
    
    <div class="banner">
            <div class="blog-title">
                <a href="/blog/">VIK&#39;s blog</a>
            </div>
            <div class="post-title">
                <a href="#" class="post-name">Storm分布式实时计算框架详解</a>
            </div>
    </div>
    
    <a class="home-link" href="/blog/">VIK's blog</a>
</header>
    <div class="wrapper">
        <div class="site-intro" style="







height:50vh;
">
    
    <!-- 主页  -->
    
    
    <!-- 404页  -->
            
    <div class="site-intro-placeholder"></div>
    <div class="site-intro-img" style="background-image: url(/blog/intro/post-bg.jpg)"></div>
    <div class="site-intro-meta">
        <!-- 标题  -->
        <h1 class="intro-title">
            <!-- 主页  -->
            
            Storm分布式实时计算框架详解
            <!-- 404 -->
            
        </h1>
        <!-- 副标题 -->
        <p class="intro-subtitle">
            <!-- 主页副标题  -->
            
            
            <!-- 404 -->
            
        </p>
        <!-- 文章页meta -->
        
            <div class="post-intros">
                <!-- 文章页标签  -->
                
                    <div class="post-intro-tags">
    
        <a class="post-tag" href="javascript:void(0);" data-tags="storm">storm</a>
    
</div>
                
                
                    <div class="post-intro-read">
                        <span>字数统计: <span class="post-count word-count">2.6k</span>阅读时长: <span class="post-count reading-time">11 min</span></span>
                    </div>
                
                <div class="post-intro-meta">
                    <span class="post-intro-calander iconfont-archer">&#xe676;</span>
                    <span class="post-intro-time">2018/12/26</span>
                    
                    <span id="busuanzi_container_page_pv" class="busuanzi-pv">
                        <span class="iconfont-archer">&#xe602;</span>
                        <span id="busuanzi_value_page_pv"></span>
                    </span>
                    
                    <span class="shareWrapper">
                        <span class="iconfont-archer shareIcon">&#xe71d;</span>
                        <span class="shareText">Share</span>
                        <ul class="shareList">
                            <li class="iconfont-archer share-qr" data-type="qr">&#xe75b;
                                <div class="share-qrcode"></div>
                            </li>
                            <li class="iconfont-archer" data-type="weibo">&#xe619;</li>
                            <li class="iconfont-archer" data-type="qzone">&#xe62e;</li>
                            <li class="iconfont-archer" data-type="twitter">&#xe634;</li>
                            <li class="iconfont-archer" data-type="facebook">&#xe67a;</li>
                        </ul>
                    </span>
                </div>
            </div>
        
    </div>
</div>
        <script>
 
  // get user agent
  var browser = {
    versions: function () {
      var u = window.navigator.userAgent;
      return {
        userAgent: u,
        trident: u.indexOf('Trident') > -1, //IE内核
        presto: u.indexOf('Presto') > -1, //opera内核
        webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
        gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核
        mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端
        ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
        android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器
        iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, //是否为iPhone或者安卓QQ浏览器
        iPad: u.indexOf('iPad') > -1, //是否为iPad
        webApp: u.indexOf('Safari') == -1, //是否为web应用程序，没有头部与底部
        weixin: u.indexOf('MicroMessenger') == -1, //是否为微信浏览器
        uc: u.indexOf('UCBrowser') > -1 //是否为android下的UC浏览器
      };
    }()
  }
  console.log("userAgent:" + browser.versions.userAgent);

  // callback
  function fontLoaded() {
    console.log('font loaded');
    if (document.getElementsByClassName('site-intro-meta')) {
      document.getElementsByClassName('intro-title')[0].classList.add('intro-fade-in');
      document.getElementsByClassName('intro-subtitle')[0].classList.add('intro-fade-in');
      var postIntros = document.getElementsByClassName('post-intros')[0]
      if (postIntros) {
        postIntros.classList.add('post-fade-in');
      }
    }
  }

  // UC不支持跨域，所以直接显示
  function asyncCb(){
    if (browser.versions.uc) {
      console.log("UCBrowser");
      fontLoaded();
    } else {
      WebFont.load({
        custom: {
          families: ['Oswald-Regular']
        },
        loading: function () {  //所有字体开始加载
          // console.log('loading');
        },
        active: function () {  //所有字体已渲染
          fontLoaded();
        },
        inactive: function () { //字体预加载失败，无效字体或浏览器不支持加载
          console.log('inactive: timeout');
          fontLoaded();
        },
        timeout: 5000 // Set the timeout to two seconds
      });
    }
  }

  function asyncErr(){
    console.warn('script load from CDN failed, will load local script')
  }

  // load webfont-loader async, and add callback function
  function async(u, cb, err) {
    var d = document, t = 'script',
      o = d.createElement(t),
      s = d.getElementsByTagName(t)[0];
    o.src = u;
    if (cb) { o.addEventListener('load', function (e) { cb(null, e); }, false); }
    if (err) { o.addEventListener('error', function (e) { err(null, e); }, false); }
    s.parentNode.insertBefore(o, s);
  }

  var asyncLoadWithFallBack = function(arr, success, reject) {
      var currReject = function(){
        reject()
        arr.shift()
        if(arr.length)
          async(arr[0], success, currReject)
        }

      async(arr[0], success, currReject)
  }

  asyncLoadWithFallBack([
    "https://cdn.jsdelivr.net/npm/webfontloader@1.6.28/webfontloader.min.js", 
    "https://cdn.bootcss.com/webfont/1.6.28/webfontloader.js",
    "/blog/lib/webfontloader.min.js"
  ], asyncCb, asyncErr)
</script>        
        <img class="loading" src="/blog/assets/loading.svg" style="display: block; margin: 6rem auto 0 auto; width: 6rem; height: 6rem;" />
        <div class="container container-unloaded">
            <main class="main post-page">
    <article class="article-entry">
        <h3 id="1-前言"><a href="#1-前言" class="headerlink" title="1. 前言"></a>1. 前言</h3><p>storm作为免费、开源、分布式的实时流处理系统，可以用于需要实时对增量的数据进行计算的场景，而且分布式的集群了可用于处理大批量数据实时处理，高可用的特点保证了实时计算的可靠性、容错性。</p>
<h3 id="2-storm介绍"><a href="#2-storm介绍" class="headerlink" title="2. storm介绍"></a>2. storm介绍</h3><h4 id="Storm对比Hadoop"><a href="#Storm对比Hadoop" class="headerlink" title="Storm对比Hadoop"></a>Storm对比Hadoop</h4><ul>
<li>数据源/处理领域<ul>
<li>Hadoop：离线批处理</li>
</ul>
</li>
<li>处理过程<ul>
<li>Hadoop: Map Reduce</li>
<li>Storm: Spout、 Bolt</li>
</ul>
</li>
<li>进程是否结束<ul>
<li>Hadoop 电梯（进程跑完就结束）</li>
<li>Storm 扶梯 （进程不结束）</li>
</ul>
</li>
<li>处理速度<ul>
<li>Hadoop处理hdfs中的tb级别的数据，较慢一点</li>
</ul>
</li>
</ul>
<h4 id="Storm对比Spark-Streaming"><a href="#Storm对比Spark-Streaming" class="headerlink" title="Storm对比Spark Streaming"></a>Storm对比Spark Streaming</h4><ul>
<li>Spark Streaming 小批处理，设置时间周期，近似实时<ul>
<li>Spark的批处理+SparkStream的近似流处理很实用，如果业务场景可以忍受几十秒、一两分钟的延时，建议使用Spark</li>
</ul>
</li>
<li>Storm 可达到毫秒级别<ul>
<li>如果做完流处理后，不需要批处理</li>
<li>对实时性要求很严格</li>
</ul>
</li>
</ul>
<h4 id="Storm优势"><a href="#Storm优势" class="headerlink" title="Storm优势"></a>Storm优势</h4><ul>
<li>编程模式 Spout+Bolt</li>
<li>扩展性 -&gt;分布式</li>
<li>可靠性 每一条数据都能被处理并只处理一次</li>
<li>容错性 容故障，硬件错误恢复能力</li>
</ul>
<h4 id="Storm应用现状与发展趋势"><a href="#Storm应用现状与发展趋势" class="headerlink" title="Storm应用现状与发展趋势"></a>Storm应用现状与发展趋势</h4><ul>
<li>应用 机器学习、实时分析、持续计算、分布式RPC、ETL</li>
<li>发展趋势<ul>
<li>社区发展、活跃度</li>
<li>企业需求</li>
<li>大数据相关的大会</li>
</ul>
</li>
</ul>
<h4 id="Storm应用场景"><a href="#Storm应用场景" class="headerlink" title="Storm应用场景"></a>Storm应用场景</h4><ul>
<li>电商行业<ul>
<li>实时分析用户的属性，并反馈给搜索引擎</li>
<li>网站性能监控，Storm收集报错日志，分析、发短信/邮件</li>
<li>实时计算用户的兴趣数据，精准投放广告</li>
</ul>
</li>
<li>电信行业<ul>
<li>流量剩余计算</li>
<li>诈骗电话识别</li>
</ul>
</li>
</ul>
<h3 id="3-线上环境准备"><a href="#3-线上环境准备" class="headerlink" title="3. 线上环境准备"></a>3. 线上环境准备</h3><ol>
<li><p>zookeeper-3.4.10</p>
<ol>
<li><a href="https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/stable" target="_blank" rel="noopener">https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/stable</a>  该目录下找到zookeeper-3.4.10下载并解压</li>
<li>进入conf目录下 <code>cp zoo_sample.cfg zoo.cfg</code>，创建zoo.cfg，因为zookeeper启动默认加载该配置文件</li>
<li>修改zookeeper的data路径  <code>dataDir=/opt/modules/zookeeper-3.4.12/zkData</code>(前提是先创建zkData文件夹)</li>
<li>进入zookeeper根目录，<code>cd /opt/modules/zookeeper-3.4.12</code>, 启动zookeeper  <code>/bin/zkServer.sh start</code>(这里只配置单机的zookeeper，需要zookeeper集群搭建的请点击 <a href="http://fantastyj.gitee.io/blog/2018/12/06/Hadoop+HBase%E9%9B%86%E7%BE%A4%E6%90%AD%E5%BB%BA/">Hadoop+HBase高可用集群搭建</a></li>
<li>查看日志文件， <code>tail -f zookeeper.out</code>查看是否启动正常</li>
</ol>
</li>
<li>apache-storm-1.1.3(若只跑本地单机模式则不需要)，启动线上storm</li>
</ol>
<ul>
<li>nimbus启动主节点 <code>nohup sh ~/app/apache-storm-1.1.3/bin/storm nimbus &amp;</code></li>
<li>supervisor 启动从节点  <code>nohup sh ~/app/apache-storm-1.1.3/bin/storm supervisor &amp;</code></li>
<li>ui 启动UI界面  <code>nohup sh storm ui &amp;</code>   访问端口:8080,可以修改配置文件 storm.yaml中的 <code>ui.port:你的端口</code></li>
<li>登录 线上服务器的ip:8080 ，可以看到storm的管理页面<ul>
<li>Total slots： 每启动一个supervisor，可供4个slots使用</li>
<li>Used slots： topology中设置的woker的总数（<code>config.setNumWorkers(3);</code>）就是 Used slots的数量</li>
<li>Executors（tasks）:  所有spout和bolt的并行数加起来的总数</li>
<li></li>
</ul>
</li>
</ul>
<h3 id="4-storm架构"><a href="#4-storm架构" class="headerlink" title="4. storm架构"></a>4. storm架构</h3><ul>
<li>类似于hadoop的架构，主从(Master/Slave)</li>
<li>Nimbus: 主<ul>
<li>集群的主节点，负责任务task的指派和分发、资源的分配</li>
</ul>
</li>
<li>Supervisor: 从<ul>
<li>集群的从节点，启动并管理Worker来负责执行任务的具体部分</li>
<li>可以启动多个Worker，具体几个呢？可以通过配置来指定</li>
<li>一个Topo可以运行在多个Worker之上，也可以通过配置指定</li>
</ul>
</li>
<li>无状态，在他们上面的信息(元数据)会存储在Zookeeper中</li>
<li>task： 每一个Spout或Bolt</li>
<li>Worker: 运行具体组件逻辑(Spout/Bolt)的进程</li>
<li>=以上是进程=====</li>
<li>task:<ul>
<li>Spout和Bolt</li>
<li>Worker中每一个Spout和Bolt的线程称为一个Task</li>
</ul>
</li>
<li>executor：executor是1个被worker进程启动的单独线程。每个executor只会运行1个topology的1个component(spout或bolt)的task</li>
</ul>
<h3 id="5-Storm并行度"><a href="#5-Storm并行度" class="headerlink" title="5. Storm并行度"></a>5. Storm并行度</h3><ul>
<li><p>一个workder进程执行的是一个topo的子集</p>
</li>
<li><p>一个worker进程会启动1..n个executor线程来执行一个topo的component(Spout&amp;Bolt)</p>
</li>
<li><p>一个运行的topo就是由集群中多台物理机上的多个worker进程组成</p>
</li>
<li><p>executor是一个呗worker进程启动的单独线程，每个executor只会运行一个topo的一个component</p>
</li>
<li><p>task是最终运行spout和bolt代码的最小执行单元</p>
</li>
<li><p>默认：</p>
<ul>
<li>一个supervisor节点最多启动4个worker进程</li>
<li>每个topo默认占用一个worker进程</li>
<li>每个worker进程会启动一个executor</li>
<li>每个executor启动一个task</li>
</ul>
</li>
<li><p>UI页面参数</p>
<ul>
<li>Total slots:4</li>
<li>Used slots:1 代表一个worker被占用了</li>
<li>Num Executors:3 bolt+spout=2 ?<ul>
<li>acker导致，占用一个</li>
</ul>
</li>
</ul>
</li>
<li><p>并行度调整</p>
<ul>
<li>worker设置</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">Config config = new Config();</span><br><span class="line">config.setNumWorkers(2);//使得Num workers:2</span><br></pre></td></tr></table></figure>
<ul>
<li>executors(threads)设置</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">TopologyBuilder builder = new TopologyBuilder();</span><br><span class="line">builder.setSpout(&quot;DataSourceSpout&quot;,new DataSourceSpout(),2);</span><br><span class="line">builder.setBolt(&quot;SumBolt&quot;,new SumBolt(),2).shuffleGrouping(&quot;DataSourceSpout&quot;);</span><br></pre></td></tr></table></figure>
<p>spout <em>2+bolt </em>2 = 4 <em>task = 4 </em>executors</p>
<ul>
<li>number of task设置</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">builder.setSpout(&quot;DataSourceSpout&quot;,new DataSourceSpout(),2);</span><br><span class="line">builder.setBolt(&quot;SumBolt&quot;,new SumBolt(),2).</span><br><span class="line">            setNumTasks(4).</span><br><span class="line">            shuffleGrouping(&quot;DataSourceSpout&quot;);</span><br></pre></td></tr></table></figure>
<p>6个task = 2(spout) + 4(bolt)</p>
<ul>
<li>把config.setNumAckers(0)去掉，会增加 worker数量的task(ack)</li>
</ul>
</li>
<li><p>动态调整 <code>$ storm rebalance mytopology -n 5 -e blue-spout=3 -e yellow-bolt=10</code>或者使用管理页面进行 rebalance</p>
</li>
</ul>
<h3 id="6-storm核心组件"><a href="#6-storm核心组件" class="headerlink" title="6. storm核心组件"></a>6. storm核心组件</h3><ul>
<li>Topology<ul>
<li>拓扑，将整个流程串起来</li>
</ul>
</li>
<li>Streams<ul>
<li>流，数据流</li>
</ul>
</li>
<li>Spouts<ul>
<li>产生数据/水的东西</li>
</ul>
</li>
<li>Bolts<ul>
<li>处理数据/水的东西 水壶/水桶 可以把数据传到下一个bolt</li>
</ul>
</li>
<li>Tuple<ul>
<li>数据/水</li>
</ul>
</li>
<li>Storm核心概念理解记忆<ul>
<li>Spout 始发站点</li>
<li>Tuple 人</li>
<li>Bolt 途径站点 处理业务逻辑，针对tuple进行处理</li>
<li>Topology 列车调度中心</li>
</ul>
</li>
<li>核心概念总结<ul>
<li>Topology 计算拓扑，由sput和bolt组成的</li>
<li>Stream 小溪流，抽象概念，没有边界的tuple组成</li>
<li>Spout 消息流的源头，Topology的消息生产者</li>
<li>Tuple 消息/数据，传递的基本单元</li>
<li>Bolt 消息处理单元，可以做过滤、聚合、查询/写数据库操作</li>
</ul>
</li>
</ul>
<h3 id="7-本地集群部署"><a href="#7-本地集群部署" class="headerlink" title="7. 本地集群部署"></a>7. 本地集群部署</h3><ul>
<li><p>词频统计案例编程</p>
<ul>
<li>需求 读取指定目录的数据，并实现单词计数功能</li>
<li>方案<ul>
<li>Spout来读取指定目录的数据，作为后续Bolt处理的input</li>
<li>使用一个Bolt把input的数据，切割开，按照逗号进行分割</li>
<li>使用一个Bolt来进行最终的单词的次数统计操作，并输出</li>
</ul>
</li>
<li>拓扑设计: DataSourceSpout ==&gt; SplitBolt ==&gt; CountBolt</li>
<li>例子源码</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br></pre></td><td class="code"><pre><span class="line">import org.apache.commons.io.FileUtils;</span><br><span class="line">import org.apache.storm.Config;</span><br><span class="line">import org.apache.storm.LocalCluster;</span><br><span class="line">import org.apache.storm.spout.SpoutOutputCollector;</span><br><span class="line">import org.apache.storm.task.OutputCollector;</span><br><span class="line">import org.apache.storm.task.TopologyContext;</span><br><span class="line">import org.apache.storm.topology.OutputFieldsDeclarer;</span><br><span class="line">import org.apache.storm.topology.TopologyBuilder;</span><br><span class="line">import org.apache.storm.topology.base.BaseRichBolt;</span><br><span class="line">import org.apache.storm.topology.base.BaseRichSpout;</span><br><span class="line">import org.apache.storm.tuple.Fields;</span><br><span class="line">import org.apache.storm.tuple.Tuple;</span><br><span class="line">import org.apache.storm.tuple.Values;</span><br><span class="line">import java.io.File;</span><br><span class="line">import java.io.IOException;</span><br><span class="line">import java.util.*;</span><br><span class="line">/**</span><br><span class="line"> * 使用Storm完成词频统计功能</span><br><span class="line"> */</span><br><span class="line">public class LocalWordCountStormTopology &#123;</span><br><span class="line"></span><br><span class="line">    public static class DataSourceSpout extends BaseRichSpout &#123;</span><br><span class="line">        private SpoutOutputCollector collector;</span><br><span class="line">        </span><br><span class="line">        public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) &#123;</span><br><span class="line">            this.collector = collector;</span><br><span class="line">        &#125;</span><br><span class="line">        /**</span><br><span class="line">         * 业务：</span><br><span class="line">         * 1） 读取指定目录的文件夹下的数据:/Users/rocky/data/storm/wc</span><br><span class="line">         * 2） 把每一行数据发射出去</span><br><span class="line">         */</span><br><span class="line">        public void nextTuple() &#123;</span><br><span class="line"></span><br><span class="line">            // 获取所有文件</span><br><span class="line">            Collection&lt;File&gt; files = FileUtils.listFiles(new File(&quot;/Users/rocky/data/storm/wc&quot;),</span><br><span class="line">                    new String[]&#123;&quot;txt&quot;&#125;,true);</span><br><span class="line"></span><br><span class="line">            for(File file : files) &#123;</span><br><span class="line">                try &#123;</span><br><span class="line">                    // 获取文件中的所有内容</span><br><span class="line">                    List&lt;String&gt; lines = FileUtils.readLines(file);</span><br><span class="line"></span><br><span class="line">                    // 获取文件中的每行的内容</span><br><span class="line">                    for(String line : lines) &#123;</span><br><span class="line"></span><br><span class="line">                        // 发射出去</span><br><span class="line">                        this.collector.emit(new Values(line));</span><br><span class="line">                    &#125;</span><br><span class="line">                    // TODO... 数据处理完之后，改名，否则一直重复执行</span><br><span class="line">                    FileUtils.moveFile(file, new File(file.getAbsolutePath() + System.currentTimeMillis()));</span><br><span class="line">                &#125; catch (IOException e) &#123;</span><br><span class="line">                    e.printStackTrace();</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line"></span><br><span class="line">        &#125;</span><br><span class="line">        public void declareOutputFields(OutputFieldsDeclarer declarer) &#123;</span><br><span class="line">            declarer.declare(new Fields(&quot;line&quot;));</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    /**</span><br><span class="line">     * 对数据进行分割</span><br><span class="line">     */</span><br><span class="line">    public static class SplitBolt extends BaseRichBolt &#123;</span><br><span class="line"></span><br><span class="line">        private OutputCollector collector;</span><br><span class="line"></span><br><span class="line">        public void prepare(Map stormConf, TopologyContext context, OutputCollector collector) &#123;</span><br><span class="line">            this.collector = collector;</span><br><span class="line">        &#125;</span><br><span class="line">        /**</span><br><span class="line">         * 业务逻辑：</span><br><span class="line">         *   line： 对line进行分割，按照逗号</span><br><span class="line">         */</span><br><span class="line">        public void execute(Tuple input) &#123;</span><br><span class="line">            String line = input.getStringByField(&quot;line&quot;);</span><br><span class="line">            String[] words = line.split(&quot;,&quot;);</span><br><span class="line"></span><br><span class="line">            for(String word : words) &#123;</span><br><span class="line">                this.collector.emit(new Values(word));</span><br><span class="line">            &#125;</span><br><span class="line"></span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">        public void declareOutputFields(OutputFieldsDeclarer declarer) &#123;</span><br><span class="line">            declarer.declare(new Fields(&quot;word&quot;));</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    /**</span><br><span class="line">     * 词频汇总Bolt</span><br><span class="line">     */</span><br><span class="line">    public static class CountBolt extends  BaseRichBolt &#123;</span><br><span class="line"></span><br><span class="line">        public void prepare(Map stormConf, TopologyContext context, OutputCollector collector) &#123;</span><br><span class="line"></span><br><span class="line">        &#125;</span><br><span class="line">        Map&lt;String,Integer&gt; map = new HashMap&lt;String, Integer&gt;();</span><br><span class="line">        /**</span><br><span class="line">         * 业务逻辑：</span><br><span class="line">         * 1）获取每个单词</span><br><span class="line">         * 2）对所有单词进行汇总</span><br><span class="line">         * 3）输出</span><br><span class="line">         */</span><br><span class="line">        public void execute(Tuple input) &#123;</span><br><span class="line">            // 1）获取每个单词</span><br><span class="line">            String word = input.getStringByField(&quot;word&quot;);</span><br><span class="line">            Integer count = map.get(word);</span><br><span class="line">            if(count == null) &#123;</span><br><span class="line">                count = 0;</span><br><span class="line">            &#125;</span><br><span class="line">            count ++;</span><br><span class="line">            // 2）对所有单词进行汇总</span><br><span class="line">            map.put(word, count);</span><br><span class="line"></span><br><span class="line">            // 3）输出</span><br><span class="line">            System.out.println(&quot;~~~~~~~~~~~~~~~~~~~~~~&quot;);</span><br><span class="line">            Set&lt;Map.Entry&lt;String,Integer&gt;&gt; entrySet = map.entrySet();</span><br><span class="line">            for(Map.Entry&lt;String,Integer&gt; entry : entrySet) &#123;</span><br><span class="line">                System.out.println(entry);</span><br><span class="line">            &#125;</span><br><span class="line"></span><br><span class="line">        &#125;</span><br><span class="line">        public void declareOutputFields(OutputFieldsDeclarer declarer) &#123;</span><br><span class="line"></span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">    public static void main(String[] args) &#123;</span><br><span class="line"></span><br><span class="line">        // 通过TopologyBuilder根据Spout和Bolt构建Topology</span><br><span class="line">        TopologyBuilder builder = new TopologyBuilder();</span><br><span class="line">        //创建Spout用于获取数据来源</span><br><span class="line">        builder.setSpout(&quot;DataSourceSpout&quot;, new DataSourceSpout());</span><br><span class="line">        //创建SplitBolt,接收DataSourceSpout的数据并进行单词拆分</span><br><span class="line">        builder.setBolt(&quot;SplitBolt&quot;, new SplitBolt()).shuffleGrouping(&quot;DataSourceSpout&quot;);</span><br><span class="line">        //创建CountBolt接收SplitBolt的数据并进行词频统计</span><br><span class="line">        builder.setBolt(&quot;CountBolt&quot;, new CountBolt()).shuffleGrouping(&quot;SplitBolt&quot;);</span><br><span class="line"></span><br><span class="line">        // 创建本地集群</span><br><span class="line">        LocalCluster cluster = new LocalCluster();</span><br><span class="line">        cluster.submitTopology(&quot;LocalWordCountStormTopology&quot;,</span><br><span class="line">                new Config(), builder.createTopology());</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
<li><p>运行： 在本地idea/eclipse中运行main方法即可执行</p>
</li>
<li>编程注意事项<ul>
<li>Topology名称不能重复，local没问题，集群不行</li>
<li>id不要以 __ 开头</li>
</ul>
</li>
</ul>
<p>​    </p>
<h3 id="8-线上集群部署"><a href="#8-线上集群部署" class="headerlink" title="8. 线上集群部署"></a>8. 线上集群部署</h3><ul>
<li><p>编译</p>
<ul>
<li><p>本地编译</p>
<ul>
<li>1、修改 pom.xml ，增加storm-core的 <code>&lt;scope&gt;provided&lt;/scope&gt;</code> 标签</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">&lt;dependency&gt;</span><br><span class="line">    &lt;groupId&gt;org.apache.storm&lt;/groupId&gt;</span><br><span class="line">    &lt;artifactId&gt;storm-core&lt;/artifactId&gt;</span><br><span class="line">    &lt;version&gt;$&#123;storm.version&#125;&lt;/version&gt;</span><br><span class="line">    &lt;exclusions&gt;</span><br><span class="line">    &lt;exclusion&gt;</span><br><span class="line">    &lt;groupId&gt;org.slf4j&lt;/groupId&gt;</span><br><span class="line">    &lt;artifactId&gt;log4j-over-slf4j&lt;/artifactId&gt;</span><br><span class="line">    &lt;/exclusion&gt;</span><br><span class="line">    &lt;exclusion&gt;</span><br><span class="line">    &lt;groupId&gt;org.slf4j&lt;/groupId&gt;</span><br><span class="line">    &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;</span><br><span class="line">    &lt;/exclusion&gt;</span><br><span class="line">    &lt;/exclusions&gt;</span><br><span class="line">    &lt;!--如果需要打包到线上去运行，需要把 provided加上--&gt;</span><br><span class="line">    &lt;scope&gt;provided&lt;/scope&gt;</span><br><span class="line">&lt;/dependency&gt;</span><br></pre></td></tr></table></figure>
<ul>
<li>2、点击IDEA中  Maven Projects-&gt;plugins-&gt;assembly-&gt;assembly:assembly 执行编译操作，在target目录生成 storm-1.0-jar-with-dependencies.jar</li>
<li>3、拷贝storm-1.0-jar-with-dependencies.jar到线上环境</li>
</ul>
</li>
<li><p>线上编译</p>
<ul>
<li>拷贝源码到线上</li>
<li>删除 target文件夹（如果之前编译过）</li>
<li>编译：<code>mvn -DskipTests=true org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5:assembly -f pom.xml</code></li>
</ul>
</li>
<li><p>运行</p>
<ul>
<li>执行<code>~/app/apache-storm-1.1.3/bin/storm jar  storm-1.0-jar-with-dependencies.jar  com.ibreezee.bigdata.storm.topology.SleepCalcuateTopology</code>,则启动topology。(其中 <code>~/app/apache-storm-1.1.3</code>是线上storm的根目录，<code>com.ibreezee.bigdata.storm.topology.LocalWordCountStormTopology</code>是Topology的包路径)</li>
</ul>
</li>
<li><p>停止</p>
<ul>
<li>执行 <code>~/app/apache-storm-1.1.3/bin/storm kill LocalWordCountStormTopology -w 1</code></li>
<li>或者从管理页面中选择topology的kill按钮</li>
</ul>
</li>
</ul>
</li>
</ul>

    </article>
    <!-- license  -->
    
        <div class="license-wrapper">
            <p>原文作者：<a href="http://fantastyj.gitee.io/blog">Eric</a>
            </p><p>原文链接：<a href="http://fantastyj.gitee.io/blog/2018/12/26/Storm分布式实时计算框架详解/">http://fantastyj.gitee.io/blog/2018/12/26/Storm分布式实时计算框架详解/</a>
            </p><p>发表日期：<a href="http://fantastyj.gitee.io/blog/2018/12/26/Storm分布式实时计算框架详解/">December 26th 2018, 8:08:28 pm</a>
            </p><p>更新日期：<a href="http://fantastyj.gitee.io/blog/2018/12/26/Storm分布式实时计算框架详解/">December 26th 2018, 8:18:17 pm</a>
            </p><p>版权声明：本文采用<a rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/">知识共享署名-非商业性使用 4.0 国际许可协议</a>进行许可</p>
        </div>
    
    <!-- paginator  -->
    <ul class="post-paginator">
        <li class="next">
            
                <div class="nextSlogan">Next Post</div>
                <a href="/blog/2019/02/20/JStorm部署及应用/" title="JStorm部署及应用">
                    <div class="nextTitle">JStorm部署及应用</div>
                </a>
            
        </li>
        <li class="previous">
            
                <div class="prevSlogan">Previous Post</div>
                <a href="/blog/2018/12/19/docker-搭建MongoDb/" title="docker-搭建MongoDb">
                    <div class="prevTitle">docker-搭建MongoDb</div>
                </a>
            
        </li>
    </ul>
    <!-- 评论插件 -->
    <!-- 来必力City版安装代码 -->

<!-- City版安装代码已完成 -->
    
    
    <!-- partial('_partial/comment/changyan') -->
    <!--PC版-->


    
    
    <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
    <script src="//unpkg.com/valine/dist/Valine.min.js"></script>
    <div id="comment"></div>
    <script>
    new Valine({
        el: '#comment' ,
        notify:false, 
        verify:false, 
        appId: "xsrAgYKsf6uAaBjhBNhCnzTC-9Nh9j0Va",
        appKey: "MRd2L7iitgfwOndKkXrnxCUs",
        placeholder: "欢迎留言分享和讨论~",
        path:window.location.pathname, 
        avatar:'mm' 
    });
    </script>


    <!-- 评论 -->
</main>
            <!-- profile -->
            
        </div>
        <footer class="footer footer-unloaded">
    <!-- social  -->
    
    <div class="social">
        
    
        
            
                <a href="mailto:465612025@qq.com" class="iconfont-archer email" title="email"></a>
            
        
    
        
            
                <a href="//github.com/WhoamiV" class="iconfont-archer github" target="_blank" title="github"></a>
            
        
    
        
            
                <span class="iconfont-archer wechat" title="wechat">
                  
                  <img class="profile-qr" src="/blog/assets/wechat_qr_code.png">
                </span>
            
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    </div>
    
    <!-- powered by Hexo  -->
    <div class="copyright">
        <span id="hexo-power">Powered by <a href="https://hexo.io/" target="_blank">Hexo</a></span><span class="iconfont-archer power">&#xe635;</span><span id="theme-info">theme <a href="https://github.com/fi3ework/hexo-theme-archer" target="_blank">Archer</a></span>
    </div>
    <!-- 不蒜子  -->
    
    <div class="busuanzi-container">
    
     
    <span id="busuanzi_container_site_pv">PV: <span id="busuanzi_value_site_pv"></span> :)</span>
    
    </div>
    
</footer>
    </div>
    <!-- toc -->
    
    <div class="toc-wrapper" style=
    







top:50vh;

    >
        <div class="toc-catalog">
            <span class="iconfont-archer catalog-icon">&#xe613;</span><span>CATALOG</span>
        </div>
        <ol class="toc"><li class="toc-item toc-level-3"><a class="toc-link" href="#1-前言"><span class="toc-number">1.</span> <span class="toc-text">1. 前言</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-storm介绍"><span class="toc-number">2.</span> <span class="toc-text">2. storm介绍</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#Storm对比Hadoop"><span class="toc-number">2.1.</span> <span class="toc-text">Storm对比Hadoop</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#Storm对比Spark-Streaming"><span class="toc-number">2.2.</span> <span class="toc-text">Storm对比Spark Streaming</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#Storm优势"><span class="toc-number">2.3.</span> <span class="toc-text">Storm优势</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#Storm应用现状与发展趋势"><span class="toc-number">2.4.</span> <span class="toc-text">Storm应用现状与发展趋势</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#Storm应用场景"><span class="toc-number">2.5.</span> <span class="toc-text">Storm应用场景</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-线上环境准备"><span class="toc-number">3.</span> <span class="toc-text">3. 线上环境准备</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4-storm架构"><span class="toc-number">4.</span> <span class="toc-text">4. storm架构</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#5-Storm并行度"><span class="toc-number">5.</span> <span class="toc-text">5. Storm并行度</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#6-storm核心组件"><span class="toc-number">6.</span> <span class="toc-text">6. storm核心组件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#7-本地集群部署"><span class="toc-number">7.</span> <span class="toc-text">7. 本地集群部署</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#8-线上集群部署"><span class="toc-number">8.</span> <span class="toc-text">8. 线上集群部署</span></a></li></ol>
    </div>
    
    <div class="back-top iconfont-archer">&#xe639;</div>
    <div class="sidebar sidebar-hide">
    <ul class="sidebar-tabs sidebar-tabs-active-0">
        <li class="sidebar-tab-archives"><span class="iconfont-archer">&#xe67d;</span><span class="tab-name">Archive</span></li>
        <li class="sidebar-tab-tags"><span class="iconfont-archer">&#xe61b;</span><span class="tab-name">Tag</span></li>
        <li class="sidebar-tab-categories"><span class="iconfont-archer">&#xe666;</span><span class="tab-name">Cate</span></li>
    </ul>
    <div class="sidebar-content sidebar-content-show-archive">
          <div class="sidebar-panel-archives">
    <!-- 在ejs中将archive按照时间排序 -->
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    <div class="total-and-search">
        <div class="total-archive">
        Total : 18
        </div>
        <!-- search  -->
        
    </div>
    
    <div class="post-archive">
    
    
    
    
    <div class="archive-year"> 2020 </div>
    <ul class="year-list">
    
    
        <li class="archive-post-item">
            <span class="archive-post-date">12/11</span><a class="archive-post-title" href="/blog/2020/12/11/多线程与高并发-JUC死锁/">多线程与高并发-JUC死锁</a>
        </li>
    
    
        <li class="archive-post-item">
            <span class="archive-post-date">12/05</span><a class="archive-post-title" href="/blog/2020/12/05/多线程与高并发-JUC之原子类-同步锁/">多线程与高并发-JUC之原子类&同步锁</a>
        </li>
    
    
        <li class="archive-post-item">
            <span class="archive-post-date">11/26</span><a class="archive-post-title" href="/blog/2020/11/26/设计模式-责任链模式/">设计模式-责任链模式</a>
        </li>
    
    
        <li class="archive-post-item">
            <span class="archive-post-date">11/20</span><a class="archive-post-title" href="/blog/2020/11/20/多线程与高并发-CAS-AQS源码分析/">多线程与高并发-CAS&AQS源码分析</a>
        </li>
    
    
        <li class="archive-post-item">
            <span class="archive-post-date">11/16</span><a class="archive-post-title" href="/blog/2020/11/16/多线程与高并发-可见性-顺序性-原子性/">多线程与高并发-可见性|顺序性|原子性</a>
        </li>
    
    
        <li class="archive-post-item">
            <span class="archive-post-date">11/11</span><a class="archive-post-title" href="/blog/2020/11/11/设计模式-代理模式/">设计模式-代理模式</a>
        </li>
    
    
        <li class="archive-post-item">
            <span class="archive-post-date">11/07</span><a class="archive-post-title" href="/blog/2020/11/07/设计模式-工厂模式/">设计模式-工厂模式</a>
        </li>
    
    
    
    
    
        </ul>
    
    <div class="archive-year"> 2019 </div>
    <ul class="year-list">
    
    
        <li class="archive-post-item">
            <span class="archive-post-date">03/03</span><a class="archive-post-title" href="/blog/2019/03/03/Mysql死锁分析/">Mysql死锁分析</a>
        </li>
    
    
        <li class="archive-post-item">
            <span class="archive-post-date">02/23</span><a class="archive-post-title" href="/blog/2019/02/23/Phoenix部署及应用/">Phoenix部署及应用</a>
        </li>
    
    
        <li class="archive-post-item">
            <span class="archive-post-date">02/20</span><a class="archive-post-title" href="/blog/2019/02/20/JStorm部署及应用/">JStorm部署及应用</a>
        </li>
    
    
    
    
    
        </ul>
    
    <div class="archive-year"> 2018 </div>
    <ul class="year-list">
    
    
        <li class="archive-post-item">
            <span class="archive-post-date">12/26</span><a class="archive-post-title" href="/blog/2018/12/26/Storm分布式实时计算框架详解/">Storm分布式实时计算框架详解</a>
        </li>
    
    
        <li class="archive-post-item">
            <span class="archive-post-date">12/19</span><a class="archive-post-title" href="/blog/2018/12/19/docker-搭建MongoDb/">docker-搭建MongoDb</a>
        </li>
    
    
        <li class="archive-post-item">
            <span class="archive-post-date">12/19</span><a class="archive-post-title" href="/blog/2018/12/19/docker-搭建Mysql/">docker-搭建Mysql</a>
        </li>
    
    
        <li class="archive-post-item">
            <span class="archive-post-date">12/15</span><a class="archive-post-title" href="/blog/2018/12/15/git使用总结/">git使用总结</a>
        </li>
    
    
        <li class="archive-post-item">
            <span class="archive-post-date">12/13</span><a class="archive-post-title" href="/blog/2018/12/13/linux常用指令分类汇总/">linux常用指令分类汇总</a>
        </li>
    
    
        <li class="archive-post-item">
            <span class="archive-post-date">12/13</span><a class="archive-post-title" href="/blog/2018/12/13/HBase之Springboot操作指南/">HBase之Springboot操作指南</a>
        </li>
    
    
        <li class="archive-post-item">
            <span class="archive-post-date">12/06</span><a class="archive-post-title" href="/blog/2018/12/06/Hadoop架构分析与实战操作/">Hadoop架构分析与实战操作</a>
        </li>
    
    
        <li class="archive-post-item">
            <span class="archive-post-date">12/06</span><a class="archive-post-title" href="/blog/2018/12/06/Hadoop+HBase集群搭建/">Hadoop+HBase高可用集群搭建</a>
        </li>
    
    </ul></div>
  </div>
        <div class="sidebar-panel-tags">
    <div class="sidebar-tags-name">
    
        <span class="sidebar-tag-name" data-tags="hadoop"><span class="iconfont-archer">&#xe606;</span>hadoop</span>
    
        <span class="sidebar-tag-name" data-tags="storm"><span class="iconfont-archer">&#xe606;</span>storm</span>
    
        <span class="sidebar-tag-name" data-tags="docker"><span class="iconfont-archer">&#xe606;</span>docker</span>
    
        <span class="sidebar-tag-name" data-tags="tools"><span class="iconfont-archer">&#xe606;</span>tools</span>
    
        <span class="sidebar-tag-name" data-tags="mysql"><span class="iconfont-archer">&#xe606;</span>mysql</span>
    
        <span class="sidebar-tag-name" data-tags="linux"><span class="iconfont-archer">&#xe606;</span>linux</span>
    
        <span class="sidebar-tag-name" data-tags="多线程与高并发"><span class="iconfont-archer">&#xe606;</span>多线程与高并发</span>
    
        <span class="sidebar-tag-name" data-tags="设计模式"><span class="iconfont-archer">&#xe606;</span>设计模式</span>
    
    </div>
    <div class="iconfont-archer sidebar-tags-empty">&#xe678;</div>
    <div class="tag-load-fail" style="display: none; color: #ccc; font-size: 0.6rem;">
    缺失模块。<br>
    1、请确保node版本大于6.2<br>
    2、在博客根目录（注意不是archer根目录）执行以下命令：<br>
    <span style="color: #f75357; font-size: 1rem; line-height: 2rem;">npm i hexo-generator-json-content --save</span><br>
    3、在根目录_config.yml里添加配置：
    <pre style="color: #787878; font-size: 0.6rem;">
jsonContent:
  meta: false
  pages: false
  posts:
    title: true
    date: true
    path: true
    text: false
    raw: false
    content: false
    slug: false
    updated: false
    comments: false
    link: false
    permalink: false
    excerpt: false
    categories: true
    tags: true</pre>
    </div> 
    <div class="sidebar-tags-list"></div>
</div>
        <div class="sidebar-panel-categories">
    <div class="sidebar-categories-name">
    
    </div>
    <div class="iconfont-archer sidebar-categories-empty">&#xe678;</div>
    <div class="sidebar-categories-list"></div>
</div>
    </div>
</div> 
    <script>
    var siteMeta = {
        root: "/blog/",
        author: "Eric"
    }
</script>
    <!-- CDN failover -->
    <script src="https://cdn.jsdelivr.net/npm/jquery@3.3.1/dist/jquery.min.js"></script>
    <script type="text/javascript">
        if (typeof window.$ === 'undefined')
        {
            console.warn('jquery load from jsdelivr failed, will load local script')
            document.write('<script src="/blog/lib/jquery.min.js">\x3C/script>')
        }
    </script>
    <script src="/blog/scripts/main.js"></script>
    <!-- algolia -->
    
    <!-- busuanzi  -->
    
    <script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    
    <!-- CNZZ  -->
    
    </div>
    <!-- async load share.js -->
    
        <script src="/blog/scripts/share.js" async></script>    
     
    </body>
</html>


